﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Utility.Inspector;

namespace Utility.DataSystem
{
	public class DataFieldCenterEditorWindow : EditorWindow
	{
		[MenuItem ("Settings/数据项管理器", priority = 100)]
		protected static DataFieldCenterEditorWindow OpenWindow ()
		{
			var window = GetWindow<DataFieldCenterEditorWindow> ();
			window.Show ();
			return window;
		}

		protected virtual void OnEnable ()
		{
			titleContent = new GUIContent ("数据项管理器");
		}

		Vector2 scrollPos;
		private void OnGUI ()
		{
			using (ScrollViewScope.New (ref scrollPos))
			{

				DrawFields ();
			}
		}

		void DrawFields ()
		{
			using (var container = ContainerScope.New ("DataFieldCenterEditoe", "数据项"))
			{
				if (container.ShowContent)
				{
					foreach (var field in FieldCenter.DataFields.Values)
					{
						using (HorizontalScope.New ())
						{
							EditorGUILayout.LabelField (field.Key);
						}
					}
				}
			}
		}
	}
}